package com.zhentao.controller;

import com.zhentao.constants.ArticleConstants;
import com.zhentao.schedule.file.article.dto.ArticleHomeDto;

import com.zhentao.service.ArticleService;
import com.zhentao.schedule.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Date 2024/4/29 15:28
 * @Author xdm
 **/

@RestController
@RequestMapping("/api/v1/article")
public class ApArticleHomeController {

    @Autowired
    private ArticleService articleService;
//    @PostMapping("/load2")
//    public ResponseResult load2(@RequestBody ArticleHomeDto dto){
//        return articleService.load2(dto, ArticleConstants.LOADTYPE_LOAD_MORE,true);
//    }
    @PostMapping("/load")
    public ResponseResult load(@RequestBody ArticleHomeDto dto){
//        return articleService.load(ArticleConstants.LOADTYPE_LOAD_MORE,dto);
        return articleService.load2(dto,ArticleConstants.LOADTYPE_LOAD_MORE,true);
    }

    @PostMapping("/loadmore")
    public ResponseResult loadmore(@RequestBody ArticleHomeDto dto){
        return articleService.load(ArticleConstants.LOADTYPE_LOAD_MORE,dto);
    }

    @PostMapping("/loadnew")
    public ResponseResult loadnew(@RequestBody ArticleHomeDto dto){
        return articleService.load(ArticleConstants.LOADTYPE_LOAD_NEW,dto);
    }

}